<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="MProductsell.aspx.cs" Inherits="MProductsell" %>

<%@ Register Src="usercontrols/MainMenu.ascx" TagName="MainMenu" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="content_general">
        <!-- Left main begin-->
        <uc1:MainMenu ID="MainMenu1" runat="server" />
        <!-- Left main -->
        <!-- Left right main begin-->
        <div class="fl left_right_main">
            <div class="member_are">
                <ul>
                    <li><span>Member Area</span> </li>
                </ul>
            </div>
            <div style="font-size: 20px" class="red">
                Post a new buying lead</div>
            <div class="form_post_sell mt_10px">
                <div class="formrow">
                    <div class="lb_medium right fl">
                        Product Name:
                    </div>
                    <input name="" type="text" class="textbox_medium fl" id="txtName"  runat="server" /><span
                        class="red1">(*)</span>
                    <div class="clr">
                    </div>
                </div>
                <div class="formrow">
                    <div class="lb_medium right fl">
                        Listing Description:
                    </div>
                    <div class="form_general_right1 form_note ">
                        <div class="form_general_right1 form_note">
                            <textarea name="textarea" class="fl textarea" id="txtListingDescription" runat="server"
                                style="height: 100px; width: 550px;"></textarea>
                            <div class="form_general_right1 form_note">
                                <span class="red1">
                                    <div id="divListingDescription">
                                    </div>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="clr">
                    </div>
                </div>
                <div class="formrow mt_5px">
                    <div class="lb_medium right fl">
                        Product Photo:</div>
                    <img src="images/img_photo.jpg" id="img" runat="server" width="100" height="99" class="fl" />
                    <div class="fl" style="width: 280px; margin-left: 10px;">
                        <asp:FileUpload ID="FULImg" runat="server" />
                        <br />
                        <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="Button1_Click" />
                        <%--<input type="button" value="Delete" style="width: 150px;" />--%>
                        <p class="form_note">
                            Image format:<span class="red1"> Jpeg, Jpg, Gif, or Png</span> Size: 3MB</p>
                    </div>
                    <div class="clr">
                    </div>
                </div>
                <div id="divcontent1" runat="server">
                    <div class="post_step mt_20px">
                        <ul>
                            <li>
                                <img src="images/post1.gif" class="fl" style="margin: 5px 20px 0 20px;" /><span class="fl bold">Basic
                                    infomation</span></li>
                            <li class="step_next">
                                <img src="images/post2a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Detailed Description </span></li>
                            <li class="step_next">
                                <img src="images/post3a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Other infomation</span></li>
                        </ul>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow ">
                        <div class="lb_medium right fl">
                            Product Keyword:
                        </div>
                        <input name="" type="text" class="textbox_medium fl" id="txtproductkey" runat="server" />
                        <span class="red1">(*)</span>
                        <div class="clr">
                        </div>
                    </div>
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <div class="formrow">
                                <div class="lb_medium right fl">
                                    Product Category:
                                </div>
                                <asp:DropDownList ID="ddlProCat" CssClass="select_medium fl" runat="server" OnSelectedIndexChanged="ddlProSubCat_OnSelectedIndexChanged"
                                    AutoPostBack="true">
                                </asp:DropDownList>
                                <%--<select name="" class="select_medium fl">
                            <option>-- Select one --</option>
                        </select>--%>
                                <span class="red1">(*)</span>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="formrow">
                                <div class="lb_medium right fl">
                                    Subcategory:
                                </div>
                                <%--<select name="" class="select_medium fl">
                            <option>-- Select one --</option>
                        </select>--%>
                                <asp:DropDownList ID="ddlSubCat" CssClass="select_medium fl" runat="server" OnSelectedIndexChanged="ddlSubCat_OnSelectedIndexChanged"
                                    AutoPostBack="true">
                                </asp:DropDownList>
                                <span class="red1">(*)</span>
                                <div class="clr">
                                </div>
                            </div>
                            <div class="formrow">
                                <div class="lb_medium right fl">
                                    Sub SubCategory:
                                </div>
                                <%--<select name="" class="select_medium fl">
                            <option>-- Select one --</option>
                        </select>--%>
                                <asp:DropDownList ID="ddlSubSubCat" CssClass="select_medium fl" runat="server">
                                </asp:DropDownList>
                                <span class="red1">(*)</span>
                                <div class="clr">
                                </div>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Description:
                        </div>
                        <div class="form_general_right1 form_note ">
                            <div class="form_general_right1 form_note">
                                <%--<input type="text" class="textbox_small fl" value="Attribuite - e.g Color" />
                                <input type="text" class="textbox_small fl" value="Attribuite - e.g Red" />--%>
                                <table width="350px" border="0" class="tbl_add" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td colspan="3" align="right">
                                            <asp:LinkButton ID="lndelete" CssClass="btn_deleteadd fl" OnClientClick="javascript: return confirm('Are you sure you want to delete this item?');"
                                                runat="server" CausesValidation="false" OnClick="lndelete_Click" ToolTip="Delete">Delete Description</asp:LinkButton>
                                        </td>
                                    </tr>
                                    <asp:Repeater runat="server" ID="rptAdd" OnItemDataBound="rptAdd_OnItemDataBound">
                                        <ItemTemplate>
                                            <tr>
                                                <td>
                                                    <asp:TextBox ID="txtTitlerpt" runat="server" CssClass="textbox_small fl"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtNamerpt" runat="server" CssClass="textbox_small fl"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:HiddenField ID="hdf" runat="server" />
                                                    <input runat="server" onclick="select_change(this.form)" id="chkDelete" type="checkbox"
                                                        value='<%# DataBinder.Eval(Container.DataItem, "AddMoreId") %>' name="delete" />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </table>
                                <table id="dataTable" class="tbl_add" width="350px" border="0">
                                    <tr>
                                        <td>
                                            <input type="text" id="title0" class="textbox_small fl" onchange="validateTitle('dataTable')" />
                                        </td>
                                        <td>
                                            <input type="text" id="name0" class="textbox_small fl" onchange="validateName('dataTable')" />
                                        </td>
                                    </tr>
                                </table>
                                <div class="form_general_right1 mt_5px">
                                    <img src="images/icon_add_more.gif" width="14" height="14" class="fl" style="margin-right: 5px;" />
                                    <a class="fl" onclick="addRow('dataTable')" style="cursor: pointer;">Add more</a>
                                    <img src="images/icon_add_more.gif" width="14" height="14" class="fl" style="margin-right: 5px;
                                        margin-left: 10px;" />
                                    <a class="fl" onclick="deleteRow('dataTable')" style="cursor: pointer;">Delete row</a>
                                    <div class="clr">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="mt_10px" style="padding-left: 160px;">
                        <asp:LinkButton ID="btncontinues1" CssClass="btn_general fl" runat="server" OnClick="btncontinues1_OnClick"
                            OnClientClick="return CheckValue()"><span class="fl">CONTINUES </span><img src="images/next.gif" width="15" height="14" class="fl" style="padding: 6px 5px 0 0px;" /></asp:LinkButton>
                        <%--<a href="#" class="btn_general fl"><span class="fl">CONTINUES </span>
                            
                        </a>--%>
                        <div class="clr">
                        </div>
                    </div>
                </div>
                <div id="divcontent2" runat="server">
                    <div class="post_step mt_20px">
                        <ul>
                            <li class="step_next">
                                <img src="images/post1a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Basic infomation</span></li>
                            <li>
                                <img src="images/post2.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Detailed Description </span></li>
                            <li class="step_next">
                                <img src="images/post3a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Other infomation</span></li>
                        </ul>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow ">
                        <%-- <textarea name="textarea" class="textarea_full" id="txtDetailDescription" runat="server"
                            style="height: 150px;"></textarea>--%>
                        <FCKeditorV2:FCKeditor ID="txtDetailDescription" runat="server" ToolbarSet="Basic"
                            Height="200px" ToolbarCanCollapse="false" BasePath="~/Javascripts/FCKEditor/">
                        </FCKeditorV2:FCKeditor>
                        <div class="formrow form_note">
                            <span class="red1">
                                <div id="divDetailDescription">
                                </div>
                            </span>
                        </div>
                    </div>
                    <div class="mt_10px" style="padding-left: 160px;">
                        <asp:LinkButton ID="lbtback1" CssClass="btn_general fl" runat="server" OnClick="lbtback1_OnClick"><img src="images/back.gif" width="15" height="14" class="fl" style="padding: 6px 0px 0 5px;" /><span
                                class="fl">back </span></asp:LinkButton>
                        <%--<a href="#" class="btn_general fl">
                            <img src="images/back.gif" width="15" height="14" class="fl" style="padding: 6px 0px 0 5px;" /><span
                                class="fl">back </span>
                        </a>--%>
                        <asp:LinkButton ID="lbtContinues2" runat="server" OnClick="lbtContinues2_OnClick"
                            CssClass="btn_general fl" Style="margin-left: 10px;"><span class="fl">CONTINUES </span>
                            <img src="images/next.gif" width="15" height="14" class="fl" style="padding: 6px 5px 0 0px;" /></asp:LinkButton>
                        <%--<a href="#" class="btn_general fl" style="margin-left: 10px;">
                            <span class="fl">CONTINUES </span>
                            <img src="images/next.gif" width="15" height="14" class="fl" style="padding: 6px 5px 0 0px;" />
                        </a>--%>
                        <div class="clr">
                        </div>
                    </div>
                </div>
                <div id="divcontent3" runat="server">
                    <div class="post_step mt_20px">
                        <ul>
                            <li class="step_next">
                                <img src="images/post1a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Basic infomation</span></li>
                            <li class="step_next">
                                <img src="images/post2a.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Detailed Description </span></li>
                            <li>
                                <img src="images/post3.gif" width="16" height="16" class="fl" style="margin: 5px 20px 0 20px;" /><span
                                    class="fl bold">Other infomation</span></li>
                        </ul>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Min. Order Quantity:
                        </div>
                        <%--<input name="" type="text" class="textbox_small fl" onkeyup="this.value = FormatNumber(this.value);"
                            id="txtMinOderQuantity" runat="server" />--%>
                        <input type="text" value="0" name="q" onkeyup="this.value = FormatNumber(this.value);"
                            runat="server" onkeydown="return processKey(event)" onfocus="if(this.value=='0') this.value='';"
                            onblur="if(this.value=='') this.value='0';" class="textbox_small fl" id="txtMinOderQuantity" />
                        <asp:DropDownList ID="ddlUnittype1" runat="server" CssClass="select fl" Width="170">
                        </asp:DropDownList>
                        <%--<select name="select" class="select fl" style="width: 170px;">
                            <option>-- Select Unit type --</option>
                            <option>dsfsdf</option>
                        </select>--%>
                        <input type="text" class="textbox_small fl" value="Other" id="txtMinOtherQuantity"
                            runat="server" />
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow ">
                        <div class="lb_medium right fl">
                            FOB Price:
                        </div>
                        <asp:DropDownList ID="ddlCurency" runat="server" CssClass="select fl" Width="135">
                        </asp:DropDownList>
                        <input type="text" value="0" name="q" onkeyup="this.value = FormatNumber(this.value);"
                            runat="server" onkeydown="return processKey(event)" onfocus="if(this.value=='0') this.value='';"
                            onblur="if(this.value=='') this.value='0';" class="textbox fl" id="txtFOBPrice1"
                            style="width: 135px;" />
                        <input type="text" value="0" name="q" onkeyup="this.value = FormatNumber(this.value);"
                            onkeydown="return processKey(event)" onfocus="if(this.value=='0') this.value='';"
                            onblur="if(this.value=='') this.value='0';" class="textbox fl" id="txtFOBPrice2"
                            runat="server" style="width: 134px;" />
                        <span class="fl" style="margin-right: 5px; line-height: 20px;">Per</span>
                        <asp:DropDownList ID="ddlUnittype2" runat="server" CssClass="select fl" Width="135">
                        </asp:DropDownList>
                        <%--<select class="select fl" style="width: 170px;">
                            <option>-- Select Unit type --</option>
                        </select>--%>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Port:
                        </div>
                        <input name="" type="text" class="textbox_medium fl" id="txtPort" runat="server" />
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Payment Terms:</div>
                        <input name="" type="text" class="textbox_medium fl" id="txtPaymentTerms" runat="server" />
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Production Capacity:
                        </div>
                        <input name="" type="text" class="textbox_medium fl" id="txtProductionCapacity" runat="server" />
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Delivery Time:
                        </div>
                        <input name="" type="text" class="textbox_medium fl" id="txtDeliveryTime" runat="server" />
                        <div class="clr">
                        </div>
                    </div>
                    <div class="formrow">
                        <div class="lb_medium right fl">
                            Packaging Details:
                        </div>
                        <div class="form_general_right1 form_note ">
                            <div class="form_general_right1 form_note">
                                <textarea name="textarea" class="fl textarea" id="txtPackagingDetails" runat="server"
                                    style="height: 100px; width: 550px;"></textarea>
                                <div class="form_general_right1 form_note">
                                    <span class="red1">
                                        <div id="divPackagingDetails">
                                        </div>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                    <div class="mt_10px" style="padding-left: 160px;">
                        <asp:LinkButton ID="lbtback2" CssClass="btn_general fl" runat="server" OnClick="lbtback2_OnClick">
                            <img src="images/back.gif" width="15" height="14" class="fl" style="padding: 6px 0px 0 5px;" /><span
                                class="fl">back </span></asp:LinkButton>
                        <asp:Button ID="Button1" CssClass="sub_mit" runat="server" OnClick="ltbfinish_OnClick"
                            Text="FINISH" />
                        <div class="clr">
                        </div>
                    </div>
                </div>
                <div class="clr">
                </div>
            </div>
        </div>
    </div>
    <div class="clr">
    </div>
    <asp:HiddenField ID="txt" runat="server" />
    <asp:HiddenField ID="txt1" runat="server" />

    <script type="text/javascript">
        fieldlimiter.setup({
	        thefield: document.getElementById("<%=this.txtListingDescription.ClientID%>"), //reference to form field
	        maxlength: 500,
	        statusids: ["divListingDescription"], //id(s) of divs to output characters limit. If non, set to empty array [].
	        onkeypress:function(maxlength, curlength){ //onkeypress event handler
		        //define custom event actions here if desired
	        }
        })
    </script>

    <script type="text/javascript">
        fieldlimiter.setup({
	        thefield: document.getElementById("<%=this.txtDetailDescription.ClientID%>"), //reference to form field
	        maxlength: 8000,
	        statusids: ["divDetailDescription"], //id(s) of divs to output characters limit. If non, set to empty array [].
	        onkeypress:function(maxlength, curlength){ //onkeypress event handler
		        //define custom event actions here if desired
	        }
        })
    </script>

    <script type="text/javascript">
            fieldlimiter.setup({
	            thefield: document.getElementById("<%=this.txtPackagingDetails.ClientID%>"), //reference to form field
	            maxlength: 128,
	            statusids: ["divPackagingDetails"], //id(s) of divs to output characters limit. If non, set to empty array [].
	            onkeypress:function(maxlength, curlength){ //onkeypress event handler
		            //define custom event actions here if desired
	            }
            })
    </script>

    <script type="text/javascript">
    
        function addRow(tableID) {
 
            var table = document.getElementById(tableID);
            
            var rowCount = table.rows.length;
            var iteration = rowCount;
            var row = table.insertRow(rowCount);  
            
            var cell2 = row.insertCell(0);
            var element2 = document.createElement("input");
            element2.type = "text";
            cell2.appendChild(element2);            
            element2.id = 'title' + iteration;
            element2.name = 'title' + iteration;           
            element2.setAttribute('class','textbox_small fl');
            element2.setAttribute('onChange',"validateTitle('dataTable')");
 
            var cell3 = row.insertCell(1);
            var element3 = document.createElement("input");
            element3.type = "text";
            cell3.appendChild(element3);
            element3.id = 'name' + iteration;
            element3.name = 'name' + iteration;
            element3.setAttribute('class','textbox_small fl');            
            element3.setAttribute('onChange',"validateName('dataTable')");
 
        };
        function deleteRow(tableID) {
            try {
            var table = document.getElementById(tableID);
            var rowCount = table.rows.length; 
            for(var i=0; i<rowCount; i++) {
                var row = table.rows[i];
                if(rowCount == i+1){
                    table.deleteRow(i);
                    rowCount--;
                    i--;
                }                
            }            
            }catch(e) {
                alert(e);
            }
            validateRow(tableID);
        };
    function validateRow(tableID)
    {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;             
        var txtTitle = document.getElementById('<%=this.txt.ClientID%>');
        var txtName = document.getElementById('<%=this.txt1.ClientID%>');
        txtName.value ='';
        txtTitle.value ='';
        for(var i=0; i<=rowCount; i++) 
        {            
            var row = table.rows[i];                
            var title = document.getElementById('title' + i).value;                
            var Name = document.getElementById('name' + i).value; 
               txtTitle.value += title +',';
               txtName.value += Name +',';              
        } 
    };
    
    function validateTitle(tableID)
    {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;             
        var txtTitle = document.getElementById('<%=this.txt.ClientID%>');
        txtTitle.value='';
        for(var i=0; i<=rowCount; i++) 
        {            
            var row = table.rows[i];                
            var title = document.getElementById('title' + i).value;
               txtTitle.value += title +',';               
        } 
    };
    function validateName(tableID)
    {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;             
        var txtName = document.getElementById('<%=this.txt1.ClientID%>');  
        txtName.value ='';      
        for(var i=0; i<=rowCount; i++) 
        {            
            var row = table.rows[i];                
            var Name = document.getElementById('name' + i).value; 
               txtName.value += Name +',';              
        } 
    }; 
    </script>

    <script type="text/javascript">
            function CheckValue()
            {
                               
                 var ddlProCat=document.getElementById("<%=ddlProCat.ClientID%>");
                 var ddlSubCat=document.getElementById("<%=ddlSubCat.ClientID%>");
                 var ddlSubSubCat=document.getElementById("<%=ddlSubSubCat.ClientID%>");                 
                 var txtName=document.getElementById("<%=txtName.ClientID%>");
                 var txtKey=document.getElementById("<%=txtproductkey.ClientID%>");
                 if(txtName.value=='')
                 {
                    alert('Name is not Null !');
                    return false;
                 }
                 if(txtKey.value=='')
                 {
                    alert('Keyword is not Null !');
                    return false;
                 }
                 if(ddlProCat.value=='0')
                 {
                    alert('Category is not Null !');
                    return false;
                 }                 
                 if(ddlSubCat.value=='0')
                 {
                    alert('SubCategory is not Null !');
                    return false;
                 }
                 if(ddlSubSubCat.value=='0')
                 {
                    alert('SubsubCategory is not Null !');
                    return false;
                 }               
            }            
    </script>

</asp:Content>
